package com.example.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Build.VERSION;

public class DataSource extends SQLiteOpenHelper {
	
    // Database Version
    private static final int DATABASE_VERSION = 1;
 
    // Database Name
    private static final String DATABASE_NAME = "demoplanete";
 
    
    private static final String CREATE_REQUEST ="create table Planete(" +
    		"id integer primary key autoincrement not null," +
    		"nom text," +
    		"taille integer," +
    		"distanceTerre integer);";
    
    private static final String UPGRADE_REQUEST="DROP TABLE +planete";
    
	public DataSource(Context context) {
		super(context, DATABASE_NAME,null, DATABASE_VERSION);
	
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_REQUEST);
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL(UPGRADE_REQUEST);
		onCreate(db);
		
	}

}
